package b2.widget.status.icon
{
	import b2.config.*;
	import b2.net.*;
	import b2.player.*;
	import b2.scene.*;
	import b2.widget.*;
	import b2.widget.status.*;
	
	import flash.display.*;
	import flash.events.*;
	import flash.filters.*;
	import flash.geom.Point;
	import flash.text.*;
	import flash.ui.Mouse;
	
	public class LoginStatus extends StatusIcon
	{
		public function LoginStatus(statusInfo:StatusInfo)
		{
			super(statusInfo);
			this.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
			this.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
		}
		
		protected function onMouseOver(event:MouseEvent):void
		{
			Mouse.cursor = "button";
			var me:PlayerInfo = PlayerInfoManager.getInstance().players[PlayerInfoManager.getInstance().myUserId];
			var globalPoint:Point = this.parent.localToGlobal(new Point(this.x, this.y));
			var tipText:String = "连续签到次数:<font color='#00AA00'> " + statusInfo.currentRequiredValue + " </font> 经验:<font color='#00AA00'> +" + statusInfo.currentBonus / 10 + " </font>%<br>"
			if (statusInfo.currentRequiredValue < statusInfo.nextRequiredValue)
				tipText += "下一次签到:<font color='#00AA00'> " + statusInfo.nextRequiredValue + " </font> 经验:<font color='#00AA00'> +" + statusInfo.nextBonus / 10 + " </font>%";
			var itemTip:BasicMessage = new BasicMessage(tipText);
			itemTip.x = globalPoint.x + this.width;
			itemTip.y = globalPoint.y;
			WidgetManager.getInstance().popOutMouseOverMessage(itemTip);
		}
		
		protected function onMouseOut(event:MouseEvent):void
		{
			Mouse.cursor = "auto";
			WidgetManager.getInstance().closeMouseOverMessage();
		}
	}
}